﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InsuranceCompany.Core.Domain.Objects
{
    public class Person :Entity
    {
        public string Name { get; set; }
        public string Surname { get; set; }
        public string Patronymic { get; set; }
        public string Phone { get; set; }
        public string Email { get; set; }
        //  gender = 1 - female, gender = 0 - male
        public int Gender { get; set; }

        public Person():base()
        {
            Name = "No name";
            Surname = "";
            Patronymic = "";
            Phone = "";
            Email = "";
            Gender = 1;
        }
        public Person(Person p) :base(p)
        {
            ErrorMessage = p.ErrorMessage;
            Name = p.Name;
            Surname = p.Surname;
            Patronymic = p.Patronymic;
            Phone = p.Phone;
            Email = p.Email;
            Gender = p.Gender;
        }
        public Person(String name, String surname, int gender, String patronymic = "", String phone = "", String email = "") :base()
        {
            Name = name;
            Surname = surname;
            Patronymic = patronymic;
            Phone = phone;
            Email = email;
            if ((gender != 0) && (gender != 1))
            {
                this.setErrorMessage("Impossible gender value!");
                return;
            }
            Gender = gender;
        }
        public Person(String name, String surname) :base()
        {
            Name = name;
            Surname = surname;
            Patronymic = "";
            Phone = "";
            Email = "";
            Gender = 1;
        }

        public Person(String name)
            : base()
        {
            Name = name;
            Surname = "";
            Patronymic = "";
            Phone = "";
            Email = "";
            Gender = 1;
        }
    }
}
